//
// Copyright (c) 2009-2011, chunquedong
//
// This file is part of ChunMap project
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE(Version >=3)
//
// History:
//   2011-05-03  Jed Young  Creation
//

using fwt
using gfx
using gfx2
using gfx2Imp

using chunmapDesktop
using chunmapModel
using chunmapUtil
using chunmapView
using chunmapRaster

class Main
{
  Void main()
  {
    //Gfx2.setEngine("AWT")

    map := MapCanvas
    {
      //layer := LayerFactory.createGeometryLayer([Geometry("LINESTRING(10.0 20.0,20.0 40.0,30.0 60.0,40.0 80.0)")])

      layer0 := VectorLayer.makeUri((this.typeof->sourceFile.toStr.toUri + `data/cntry02/cntry02.shp`))
      layers.add(layer0)

      //layer := LayerFactory.openShapeFile(this.typeof->sourceFile.toStr.toUri + `data/region.shp`, Charset.fromStr("GBK"), 1)
      //layerList.add(layer)
/*
      layer2 := LayerFactory.openShapeFile(this.typeof->sourceFile.toStr.toUri + `data/river.shp`, Charset.fromStr("GBK"))
      layerList.add(layer2)

      layer4 := LayerFactory.openShapeFile(this.typeof->sourceFile.toStr.toUri + `data/theme1.shp`, Charset.fromStr("GBK"))
      layer4.selecter.defaultSym.style.stroke = Pen { width = 3}
      layerList.add(layer4)

      layer3 := LayerFactory.openShapeFile(this.typeof->sourceFile.toStr.toUri + `data/city1.shp`, Charset.fromStr("GBK"), 1)
      layerList.add(layer3)

      */

      fullView
    }

    Window
    {
      title = "chunmap"
      size = Size(900,600)
      EdgePane
      {
        center = InsetPane { size = Size(900,500); content = map }
        bottom = Button{ text = "reset"; onAction.add { map.fullView.renderMap }}
      },
    }.open
  }
}